<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="generator" content="VuePress 2.0.0-beta.27">
    <link rel="icon" href="favicon.ico"><meta name="keywords" content="Cosla前端,Cosla开发,Cosla文档,酷斯啦前端,酷斯啦开发,酷斯啦文档"><title>网页端开发事项 | 前端团队开发文档</title><meta name="description" content="Cosla开发，Cosla前端团队开发文档">
    <link rel="preload" href="/assets/js/runtime~app.7eeb5ba6.js" as="script"><link rel="preload" href="/assets/css/styles.a0dfb1ca.css" as="style"><link rel="preload" href="/assets/js/6135.d16fec79.js" as="script"><link rel="preload" href="/assets/js/app.4602c005.js" as="script">
    <link rel="stylesheet" href="/assets/css/styles.a0dfb1ca.css">
  </head>
  <body>
    <div id="app"><!--[--><div class="theme-container"><!--[--><header class="navbar"><div class="toggle-sidebar-button" title="toggle sidebar" aria-expanded="false" role="button" tabindex="0"><div class="icon" aria-hidden="true"><span></span><span></span><span></span></div></div><span><a href="/" class=""><!----><span class="site-name can-hide">前端团队开发文档</span></a></span><div class="navbar-links-wrapper" style=""><!--[--><!--]--><nav class="navbar-links can-hide"><!--[--><div class="navbar-links-item"><a href="/pages/resourcePack/" class="nav-link" aria-label="资源包"><!--[--><!--]--> 资源包 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/pages/knowledge/developmentNorm/" class="nav-link" aria-label="知识库"><!--[--><!--]--> 知识库 <!--[--><!--]--></a></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="开发事项"><span class="title">开发事项</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="开发事项"><span class="title">开发事项</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a aria-current="page" href="/pages/developAttention/vehicleWebClient/" class="router-link-active router-link-exact-active nav-link router-link-active" aria-label="网页端"><!--[--><!--]--> 网页端 <!--[--><!--]--></a></li><li class="dropdown-item"><a href="/pages/developAttention/vehicleMiniprogram/" class="nav-link" aria-label="小程序端"><!--[--><!--]--> 小程序端 <!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="自定义组件"><span class="title">自定义组件</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="自定义组件"><span class="title">自定义组件</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a href="/pages/customComponents/vehicleWebClient/detailsLayout/" class="nav-link" aria-label="网页端"><!--[--><!--]--> 网页端 <!--[--><!--]--></a></li><li class="dropdown-item"><a href="/pages/customComponents/vehicleMiniprogram/plate/" class="nav-link" aria-label="小程序端"><!--[--><!--]--> 小程序端 <!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><!--]--></nav><!--[--><!--]--><button class="toggle-dark-button" title="toggle dark mode"><svg style="" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z" fill="currentColor"></path><path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path><path d="M2 15.005h5v2H2z" fill="currentColor"></path><path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 25.005h2v5h-2z" fill="currentColor"></path><path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path><path d="M25 15.005h5v2h-5z" fill="currentColor"></path><path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 2.005h2v5h-2z" fill="currentColor"></path></svg><svg style="display:none;" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z" fill="currentColor"></path></svg></button><!----></div></header><!--]--><div class="sidebar-mask"></div><!--[--><aside class="sidebar"><nav class="navbar-links"><!--[--><div class="navbar-links-item"><a href="/pages/resourcePack/" class="nav-link" aria-label="资源包"><!--[--><!--]--> 资源包 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/pages/knowledge/developmentNorm/" class="nav-link" aria-label="知识库"><!--[--><!--]--> 知识库 <!--[--><!--]--></a></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="开发事项"><span class="title">开发事项</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="开发事项"><span class="title">开发事项</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a aria-current="page" href="/pages/developAttention/vehicleWebClient/" class="router-link-active router-link-exact-active nav-link router-link-active" aria-label="网页端"><!--[--><!--]--> 网页端 <!--[--><!--]--></a></li><li class="dropdown-item"><a href="/pages/developAttention/vehicleMiniprogram/" class="nav-link" aria-label="小程序端"><!--[--><!--]--> 小程序端 <!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="自定义组件"><span class="title">自定义组件</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="自定义组件"><span class="title">自定义组件</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a href="/pages/customComponents/vehicleWebClient/detailsLayout/" class="nav-link" aria-label="网页端"><!--[--><!--]--> 网页端 <!--[--><!--]--></a></li><li class="dropdown-item"><a href="/pages/customComponents/vehicleMiniprogram/plate/" class="nav-link" aria-label="小程序端"><!--[--><!--]--> 小程序端 <!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><!--]--></nav><!--[--><!--]--><ul class="sidebar-links"><!--[--><!--[--><a aria-current="page" href="/pages/developAttention/vehicleWebClient/" class="router-link-active router-link-exact-active nav-link router-link-active sidebar-heading sidebar-item active" aria-label="网页端开发事项"><!--[--><!--]--> 网页端开发事项 <!--[--><!--]--></a><ul class=""><li><!--[--><a aria-current="page" href="/pages/developAttention/vehicleWebClient/#技术栈" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="技术栈"><!--[--><!--]--> 技术栈 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/pages/developAttention/vehicleWebClient/#开发环境" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="开发环境"><!--[--><!--]--> 开发环境 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/pages/developAttention/vehicleWebClient/#启动步骤" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="启动步骤"><!--[--><!--]--> 启动步骤 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/pages/developAttention/vehicleWebClient/#注意事项" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="注意事项"><!--[--><!--]--> 注意事项 <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/pages/developAttention/vehicleWebClient/#_1-新建页面" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="1.新建页面"><!--[--><!--]--> 1.新建页面 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/pages/developAttention/vehicleWebClient/#_2-静态资源" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="2.静态资源"><!--[--><!--]--> 2.静态资源 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/pages/developAttention/vehicleWebClient/#_3-网络请求" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="3.网络请求"><!--[--><!--]--> 3.网络请求 <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><a aria-current="page" href="/pages/developAttention/vehicleWebClient/#项目目录" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="项目目录"><!--[--><!--]--> 项目目录 <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--]--></ul><!--[--><!--]--></aside><!--]--><!--[--><main class="page"><!--[--><!--]--><div class="theme-default-content"><!--[--><h1 id="网页端开发事项" tabindex="-1"><a class="header-anchor" href="#网页端开发事项" aria-hidden="true">#</a> 网页端开发事项</h1><h2 id="技术栈" tabindex="-1"><a class="header-anchor" href="#技术栈" aria-hidden="true">#</a> 技术栈</h2><ul><li><a href="https://v3.cn.vuejs.org/" target="_blank" rel="noopener noreferrer">vue@3.1.4<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a></li><li><a href="https://2x.antdv.com/components/overview/" target="_blank" rel="noopener noreferrer">ant-design-vue@2.2.2<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a></li><li><a href="https://next.router.vuejs.org/" target="_blank" rel="noopener noreferrer">vue-router@4.0.10<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a></li><li><a href="https://next.vuex.vuejs.org/" target="_blank" rel="noopener noreferrer">vuex@4.0.2<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a></li><li><a href="https://axios-http.com/zh/docs/intro/" target="_blank" rel="noopener noreferrer">axios@0.21.1<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a></li><li><a href="https://less.bootcss.com/" target="_blank" rel="noopener noreferrer">less@4.1.1<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a></li><li><a href="https://www.webpackjs.com/concepts/" target="_blank" rel="noopener noreferrer">webpack@4.41.30<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a></li><li><a href="https://day.js.org/docs/zh-CN/installation/installation" target="_blank" rel="noopener noreferrer">dayjs@1.10.6<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a></li><li><a href="https://www.lodashjs.com/" target="_blank" rel="noopener noreferrer">lodash@4.17.21<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a></li><li><a href="https://github.com/LancerComet/vue-jsonp#readme" target="_blank" rel="noopener noreferrer">vue-jsonp@2.0.0<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a></li><li><a href="https://github.com/rockboom/SheetJS-docs-zh-CN" target="_blank" rel="noopener noreferrer">xlsx@0.17.4<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a></li></ul><h2 id="开发环境" tabindex="-1"><a class="header-anchor" href="#开发环境" aria-hidden="true">#</a> 开发环境</h2><p><code>vscode</code></p><h2 id="启动步骤" tabindex="-1"><a class="header-anchor" href="#启动步骤" aria-hidden="true">#</a> 启动步骤</h2><ol><li>npm i</li><li>npm run serve</li></ol><h2 id="注意事项" tabindex="-1"><a class="header-anchor" href="#注意事项" aria-hidden="true">#</a> 注意事项</h2><h3 id="_1-新建页面" tabindex="-1"><a class="header-anchor" href="#_1-新建页面" aria-hidden="true">#</a> 1.新建页面</h3><ol start="2"><li>根据模块在<code>views</code>文件夹下创建对应文件夹</li><li>根据具体功能创建文件夹，如<code>add</code>、<code>edit</code>、<code>details</code></li><li>在对应功能下创建<code>index.vue</code>，根据需要判断是否需要创建同级<code>components</code>文件夹</li><li>在<code>router/index.js</code>创建路由</li></ol><div class="language-javascript ext-js line-numbers-mode"><pre class="language-javascript"><code><span class="token comment">// 路由示例</span>

<span class="token punctuation">{</span>
    path<span class="token operator">:</span> <span class="token string">&#39;/vehicle-manage&#39;</span><span class="token punctuation">,</span>
    name<span class="token operator">:</span> <span class="token string">&#39;VehicleManage&#39;</span><span class="token punctuation">,</span>
    component<span class="token operator">:</span> Layout<span class="token punctuation">,</span>
    redirect<span class="token operator">:</span> <span class="token string">&#39;/vehicle-manage/details&#39;</span><span class="token punctuation">,</span>
    children<span class="token operator">:</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            path<span class="token operator">:</span> <span class="token string">&#39;details&#39;</span><span class="token punctuation">,</span>
            name<span class="token operator">:</span> <span class="token string">&#39;VehicleDetails&#39;</span><span class="token punctuation">,</span>
            <span class="token function-variable function">component</span><span class="token operator">:</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token keyword">import</span><span class="token punctuation">(</span><span class="token string">&#39;@/views/vehicle/details&#39;</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
            meta<span class="token operator">:</span> <span class="token punctuation">{</span>
                title<span class="token operator">:</span> <span class="token string">&#39;车辆详情&#39;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            path<span class="token operator">:</span> <span class="token string">&#39;add&#39;</span><span class="token punctuation">,</span>
            name<span class="token operator">:</span> <span class="token string">&#39;AddVehicle&#39;</span><span class="token punctuation">,</span>
            <span class="token function-variable function">component</span><span class="token operator">:</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token keyword">import</span><span class="token punctuation">(</span><span class="token string">&#39;@/views/vehicle/add&#39;</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
            meta<span class="token operator">:</span> <span class="token punctuation">{</span>
                title<span class="token operator">:</span> <span class="token string">&#39;新增车辆&#39;</span><span class="token punctuation">,</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token punctuation">}</span>
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br></div></div><p>注意事项：路由添加后访问403可能原因为登录账号没有该页面访问权限</p><p>解决方案：</p><ul><li>在<code>config/config.js</code>中添加<code>routesWhiteList</code>配置项，设置路由白名单。上线时注意移除该文件的<code>routesWhiteList</code>配置！！！该配置仅在开发阶段使用，线上根据用户权限而定。</li><li>请后端小伙伴添加路由权限</li></ul><h3 id="_2-静态资源" tabindex="-1"><a class="header-anchor" href="#_2-静态资源" aria-hidden="true">#</a> 2.静态资源</h3><p>项目中使用到的小图标放置<code>assets</code>文件夹，根据模块创建文件夹后放置切图。</p><h3 id="_3-网络请求" tabindex="-1"><a class="header-anchor" href="#_3-网络请求" aria-hidden="true">#</a> 3.网络请求</h3><p>所有的网络请求方法均放置在<code>api</code>文件夹中，根据模块命名请求文件，模块中放置该模块所有的请求方法。</p><p>请求方法书写示例：</p><div class="language-javascript ext-js line-numbers-mode"><pre class="language-javascript"><code><span class="token comment">// user.js</span>

<span class="token keyword">import</span> request <span class="token keyword">from</span> <span class="token string">&#39;@/utils/request&#39;</span>

<span class="token doc-comment comment">/**
 * 获取用户token
 */</span>
<span class="token keyword">export</span> <span class="token keyword">function</span> <span class="token function">userToken</span><span class="token punctuation">(</span><span class="token parameter">tempToken</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> <span class="token function">request</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
    url<span class="token operator">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/user/token/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>tempToken<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span>
    method<span class="token operator">:</span> <span class="token string">&#39;GET&#39;</span><span class="token punctuation">,</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span>

</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br></div></div><p>调用请求方法示例：</p><div class="language-javascript ext-js line-numbers-mode"><pre class="language-javascript"><code><span class="token comment">// 引入请求方法</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> userToken <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&#39;@/api/user&#39;</span>

<span class="token keyword">const</span> <span class="token punctuation">{</span> data <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">userToken</span><span class="token punctuation">(</span>tempToken<span class="token punctuation">)</span>
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p>注意事项：</p><ul><li><p>请求方法都默认添加loading及错误提示，去除该默认行为请见下方示例</p><div class="language-javascript ext-js line-numbers-mode"><pre class="language-javascript"><code><span class="token comment">// 去除loading</span>
<span class="token keyword">export</span> <span class="token keyword">function</span> <span class="token function">getContractDetails</span><span class="token punctuation">(</span><span class="token parameter">serviceStationContractId</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> <span class="token function">request</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
    url<span class="token operator">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">service-station-contract/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>serviceStationContractId<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">/detail</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span>
    method<span class="token operator">:</span> <span class="token string">&#39;GET&#39;</span><span class="token punctuation">,</span>
    headers<span class="token operator">:</span> <span class="token punctuation">{</span>
      showLoading<span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span>

<span class="token comment">// 去除错误提示</span>
<span class="token keyword">export</span> <span class="token keyword">function</span> <span class="token function">validateServiceStationName</span><span class="token punctuation">(</span><span class="token parameter">data</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> <span class="token function">request</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
    url<span class="token operator">:</span> <span class="token string">&#39;/service-station/validate/service-station-name&#39;</span><span class="token punctuation">,</span>
    method<span class="token operator">:</span> <span class="token string">&#39;POST&#39;</span><span class="token punctuation">,</span>
    data<span class="token punctuation">,</span>
    headers<span class="token operator">:</span> <span class="token punctuation">{</span> hideError<span class="token operator">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span>


</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br></div></div></li><li><p>由于ES的缘故<strong>post/delete请求默认添加1s延迟</strong>，可通过在headers添加noWait:true去除该行为，可通过在headers添加wait(单位秒)定制化延迟时间。</p></li></ul><h2 id="项目目录" tabindex="-1"><a class="header-anchor" href="#项目目录" aria-hidden="true">#</a> 项目目录</h2><details class="custom-container details"><summary>点击展开</summary><div class="language-text ext-text line-numbers-mode"><pre class="language-text"><code>.
├── README.md
├── babel.config.js                         // 代码babel配置
├── build.sh
├── dist
├── node_modules
├── package-lock.json
├── package.json
├── prettier.config.js                      // 代码格式化配置
├── public                                  // 静态资源
│   ├── favicon.ico
│   ├── index.html
│   └── static
│       └── css
│           └── loading.css
├── src
│   ├── App.vue
│   ├── api                                 // 网络请求文件
│   ├── assets                              // 图片等资源
│   ├── components                          // 自定义组件
│   ├── config                              // 项目配置文件
│   │   ├── config.js
│   │   ├── default
│   │   │   ├── index.js
│   │   │   ├── network.config.js
│   │   │   └── setting.config.js
│   │   └── index.js
│   ├── directives                          // 指令文件
│   │   ├── clickOutside.js
│   │   ├── formControl.js
│   │   ├── index.js
│   │   └── preventReClick.js
│   ├── layout
│   │   ├── components
│   │   │   └── TopMenu.vue
│   │   └── index.vue
│   ├── main.js                             // 入口文件
│   ├── router                              // 路由
│   │   ├── index.js
│   │   └── permissions.js
│   ├── store                               // vuex
│   │   ├── index.js
│   │   └── modules
│   │       ├── settings.js
│   │       └── user.js
│   ├── styles                              // 样式文件
│   │   ├── index.less
│   │   ├── mixin.less
│   │   ├── normalize.less
│   │   └── variable.less
│   ├── utils                               // 工具类文件
│   │   ├── accessToken.js
│   │   ├── clipboard.js
│   │   ├── htmlToPdf.js
│   │   ├── index.js
│   │   ├── pageTitle.js
│   │   ├── removeTempToken.js
│   │   ├── request.js
│   │   └── validate.js
│   └── views                               // 页面文件
│       ├── 401.vue
│       ├── 403.vue
│       ├── 404.vue
│       ├── faultManage
│       │   ├── add
│       │   │   └── index.vue
│       │   └── details
│       │       └── index.vue
│       ├── fittingManage
│       │   └── details
│       │       └── index.vue
│       ├── login
│       │   └── index.vue
│       ├── version.vue
└── vue.config.js
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br><span class="line-number">63</span><br><span class="line-number">64</span><br><span class="line-number">65</span><br><span class="line-number">66</span><br><span class="line-number">67</span><br><span class="line-number">68</span><br><span class="line-number">69</span><br><span class="line-number">70</span><br><span class="line-number">71</span><br><span class="line-number">72</span><br><span class="line-number">73</span><br><span class="line-number">74</span><br><span class="line-number">75</span><br></div></div></details><!--]--></div><footer class="page-meta"><!----><div class="meta-item last-updated"><span class="meta-item-label">上次更新: </span><span class="meta-item-info">2022-4-14 19:12:57</span></div><div class="meta-item contributors"><span class="meta-item-label">Contributors: </span><span class="meta-item-info"><!--[--><!--[--><span class="contributor" title="email: 1928537900@qq.com">jinleiFu</span><!----><!--]--><!--]--></span></div></footer><!----><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
    <script src="/assets/js/runtime~app.7eeb5ba6.js" defer></script><script src="/assets/js/6135.d16fec79.js" defer></script><script src="/assets/js/app.4602c005.js" defer></script>
  </body>
</html>
